import java.util.Scanner;

/** 
   This program reads information about coins and 
   prints the value of the coins.
*/
public class Coins
{
   public static void main(String[] args)
   {
      // Define constants
      final String P_TYPE = "P";
      final String N_TYPE = "N";
      final String D_TYPE = "D";
      final String Q_TYPE = "Q";

      // Read a number and type of coin 
      System.out.println("Enter number and type of coins: ");

      Scanner in = new Scanner(System.in);
      int numCoins = in.nextInt();
      String typCoin = in.next();

      // Determine and print worth of coin pile

      // Use output statements
 double value;
      if(typCoin.charAt(0) == P_TYPE.charAt(0)){
         value = 0.001 * numCoins;
      }
      else if(typCoin.charAt(0) == N_TYPE.charAt(0)){
         value = 0.05 * numCoins;
      }
      else if(typCoin.charAt(0) == D_TYPE.charAt(0)){
         value = 0.10 * numCoins;
      }
      else if(typCoin.charAt(0) == Q_TYPE.charAt(0)){
         value = 0.25 * numCoins;
      }
      else{
         value = 0;
      }

    
      if(value==0){ System.out.println("Error");}
       else { System.out.printf("$%.2f\n", value);}
   }
}